import type { BaseResponse } from '@/utils/request';
import { request } from '@/utils/request';

const Api = {
  isLogin: 'account/isLogin',
  login: 'account/login',
  logout: 'account/logout',
  notify: 'account/notify'

} as const;

/**
 * 是否登录
 * @returns
 */
export function isLogin() {
  return request<BaseResponse<Boolean>>({
    url: Api.isLogin,
    method: 'get',
  });
}

/**
 * 登录
 * @returns
 */
export function login(params: API.LoginParams) {
  return request<BaseResponse<API.AccountInfo>>({
    url: Api.login,
    method: 'get',
    params: params
  });
}

/**
 * 退出登录
 * @returns
 */
export function logout() {
  return request<BaseResponse<void>>({
    url: Api.logout,
    method: 'get',
  });
}


/**
 * 修改密码
 * @param data
 * @returns
 */
 export function updatePassword(data: API.passParams) {
  return request<BaseResponse<API.operationInfo>>({
    url: Api.notify,
    method: 'post',
    data: data,
  });
}





